<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
	String basePath = path  + request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>" />
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="layui/css/layui.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="layui/layui.js"></script>
<script src="js/jquery.min.js"></script>
</head>
<body>
	<h2>添加员工考勤信息</h2>
<div class="container"><!-- 变成一个容器  container-fuid 两边不留空隙-->
		<form id="form-user-add" class="form-horizontal layui-form" lay-filter="userfrom" action="attend/add" method="post"><!-- 栅格式布局,加form的功能 -->
            <h4 class="form-header h4">基本信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>姓名:</label>
                        <div class="col-sm-8">
                            <input name="staffname" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" required lay-verify="required">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>性别：</label>
                        <div class="col-sm-8">
							 <select name="sex" class="form-control m-b" >
				               <option value="0">男</option>
				               <option value="1">女</option>
				               
				            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>部门：</label>
                        <div class="col-sm-8">
                            <!-- <select name="deptld"></select> -->
                            <select id="depa" name="department.deptId"></select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>签到日期：</label>
                        <div class="col-sm-8">
                            <input id="email" name="attenddate" class="form-control email" type="text" maxlength="20" placeholder="请输入邮箱" required lay-verify="required">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>签到时间：</label>
                        <div class="col-sm-8">
                            <input id="loginName" name="attendin" placeholder="HH:mm:ss" class="form-control" type="text" maxlength="30" required lay-verify="required">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>退签时间：</label>
                        <div class="col-sm-8">
                            <input id="haha" name="attendout"  class="form-control" type="text"  required lay-verify="required"  placeholder="HH:mm:ss">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">备注：</label>
                        <div class="col-sm-8">
                           <input name="remark" placeholder="请输入登录密码" class="form-control" type="text"  lay-verify="required">
                        </div>
                    </div>
                </div>

            </div>
            							<!--lay-submit 代表这个按钮是layui的提交按钮 否则没有layui验证效果 -->
            <button id="tijiaoa" type="submit" class="btn btn-success" lay-submit lay-filter="formDemo">提交</button>
        </form>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		loadDepts();
	})

	layui.use(['form','laydate'],function(){
		layui.laydate.render({
			 elem: '#email' //指定元素
		});
		
		layui.laydate.render({
			 elem: '#loginName',
			 type: 'time'
		});
		
		layui.laydate.render({
			 elem: '#haha',
			 type: 'time'
		});
	});
	
	
	function loadDepts(){
		$.get('attend/listdept',function(data){
			$.each(data,function(){
				$("<option></option>").val(this.deptId).text(this.deptname).appendTo("#depa");
			});
			
			layui.form.render('select');
		});
	}
</script>
</html>
















